<template>
  <div class="mainContainer">
    <header>
      <img class="head" :src="headImg" @click="jumpToUser()"/>
    </header>
    <div class="filesTableContainer">
      <div class="fileTable" ref="fileTable">
        <div class="row">
          <div class="col" style="width: 40%">
            <span class="colData">名称</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import goodStorage from 'good-storage'
import centerutil from '../utils/centerutil'
export default {
  name: "file",
  data (){
    return {
      user: null,
      headImg: ''
    }
  },
  methods: {
    jumpToUser: function(){
      this.$router.push('/user')
    }
  },
  created () {
    let userData = goodStorage.session.get('user')
    console.log(userData)
    if (userData === undefined) {
      this.$router.push('/login')
    }
    this.user = userData
    this.headImg = userData.head
  },
  mounted() {
    let tableElement = this.$refs.fileTable
    let tableHeight = parseInt(window.getComputedStyle(tableElement).width)
    let tableMargin = -(tableHeight / 2)
    tableElement.style.marginLeft = tableMargin.toString() + 'px';
  }
}
</script>

<style src="../style/file.less" lang="less"></style>
